package com.wc.tt;

import com.wc.tt.CalculatorContext;
import com.wc.tt.impl.AddCalculator;
import com.wc.tt.impl.MultiCalculator;
import com.wc.tt.impl.SubCalculator;

public class DemoTest {
    public static void main(String[] args) {
        CalculatorContext context = new CalculatorContext();

        context.setCalculator(new AddCalculator());
        System.out.println(context.cal(10, 5));

        context.setCalculator(new SubCalculator());
        System.out.println(context.cal(10, 5));

        context.setCalculator(new MultiCalculator());
        System.out.println(context.cal(10, 5));
    }
    //public static int cal(Integer num1, Integer num2, String op) {
    //    switch (op) {
    //        case "+":
    //            return num1 + num2;
    //        case "-":
    //            return num1 - num2;
    //        case "*":
    //            return num1 * num2;
    //        case "/":
    //            return num1 / num2;
    //        case "%":
    //            return num1 % num2;
    //        default:
    //            throw new RuntimeException("operation error");
    //    }
    //}
    //
    //public static void main(String[] args) {
    //    System.out.println(cal(10, 5, "+"));
    //    System.out.println(cal(10, 5, "-"));
    //    System.out.println(cal(10, 5, "*"));
    //    System.out.println(cal(10, 5, "/"));
    //    System.out.println(cal(10, 5, "%"));
    //}
}